package com.heyqing.greedy;

import java.util.List;
import java.util.Scanner;

/**
 * ClassName:Test
 * Package:com.heyqing.greedy
 * Description:
 *  测试类
 * @Date:2024/5/27
 * @Author:Heyqing
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入活动数量（活动数为整数）:");
        int activityNum = sc.nextInt();
        Activity[] activities = new Activity[activityNum];
        for (int i = 0; i < activityNum; i++) {
            System.out.print("第"+(i+1)+"个活动:开始时间：");
            int start = sc.nextInt();
            System.out.print("\t结束时间：");
            int end = sc.nextInt();
            activities[i] = new Activity(start,end);
        }
        sc.close();
        ActivitySelector selector = new ActivitySelector();
        List<Activity> result = selector.findMaximalCompatibleSubset(activities);
        // 输出结果
        for (Activity activity : result) {
            System.out.println("活动开始时间: " + activity.start + ", 结束时间: " + activity.finish);
        }
    }
}
